<?php


    header("P3P: CP=CURa ADMa DEVa PSAo PSDo OUR BUS UNI PUR INT DEM STA PRE COM NAV OTC NOI DSP COR");
	header("Cache-Control: no-cache");
	require_once "../../htdocs/global.php";

    // 设置当前css js page目录
    require "../../include/conf/Conf_JsPackage.php";
    require "../../include/conf/Conf_CssPackage.php";
    Tool_CssJs::setJSPackage(Conf_JsPackage::$packages);
    Tool_CssJs::setCSSPackage(Conf_CssPackage::$packages);

?><!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<?php
	echo Tool_CssJs::getCssHtml(array(
		'css/pic/base.css',
        'css/pic/s-spr.css',
        'css/pic/s-pop.css',
        'css/pic/s-modular.css',
        'css/pic/s-list.css',
        'css/pic/s-common.css',
        'css/pic/s-btn.css',
		'css/pic/m-plus.css',
	));
?>
<style type="text/css">
body,form,p,h1,h2,h3,h4{margin:0;padding:0;}
img{border:none;}
body{color:#333;font:12px/1.4 Arial,"宋体",Tahoma,sans-serif;background:transparent;}
a{color:#0192b5;text-decoration:none;}
a:hover{text-decoration:underline;}
.input_text{color:#333;}
.vam{vertical-align:middle;}
.vab{vertical-align:text-bottom;}
.dib{display:inline-block;*display:inline;zoom:1;}
.login{padding:40px 52px 50px;background:url(http://<?php echo IMG_HOST ?>/pici/plus_login_top.png) repeat-x 0 0;}
.login_form .row_text,
.login_form .row_code{margin-bottom:16px;position:relative;padding-top:5px;}
.login_form .row_code .input_text{width:140px;}
.login_form .row_code *{vertical-align:bottom;}
.login_form .row_check{margin:-10px 0 16px;}
.login_form .input_text{font-size:14px;width:280px;vertical-align:top;margin:0;padding:9px 6px;border:1px solid #ccc;-webkit-box-shadow:inset 0 1px 3px rgba(0,0,0,.1);-moz-box-shadow:inset 0 1px 3px rgba(0,0,0,.1);box-shadow:inset 0 1px 3px rgba(0,0,0,.1);}
.login_form .input_text:focus{-webkit-box-shadow:inset 0 1px 4px rgba(0,0,0,.12);-moz-box-shadow:inset 0 1px 4px rgba(0,0,0,.12);box-shadow:inset 0 1px 4px rgba(0,0,0,.12);}
.login_form .input_check{margin-left:0;padding-left:0;}
.login_form .btn_submit{width:102px;height:33px;padding:0;margin:0 20px 0 0;cursor:pointer;vertical-align:middle;border:none;background:url(http://<?php echo IMG_HOST ?>/pici/plus_sprite-6.png) no-repeat 0 -120px;}
.login_form .error{position:absolute;top:6px;left:305px;width:206px;color:#dd4b39;font-size:14px;line-height:33px;padding:0 9px;background-color:#ffe5e5;border:1px solid #ffb7b7;}
.login_form .error .i_arrow{position:absolute;top:11px;left:-7px;width:8px;height:13px;overflow:hidden;background:url(http://<?php echo IMG_HOST ?>/pici/plus_sprite-6.png) no-repeat 0 -160px;}

/**@common
 * 按钮类 */
.btn{display:inline-block;*display:inline;*zoom:1;vertical-align:top;}
.btn a,
.btn span,
.btn em{display:block;_display:inline;_zoom:1;}
.btn b{font-weight:normal;}
.btn a:hover{text-decoration:none;}
.btn button,
.btn input{color:#fff;padding:0;margin:0;background:none;border:none;overflow:hidden;}
.btn .default,
.btn .default span{background-repeat:no-repeat;}
.btn .default{padding-right:10px;background-position:100% -40px;}
.btn .default,
.btn .default *{cursor:pointer;}
.btn .default span{padding:0px;background-position:0 0;}
.btn .default em{font-style:normal;text-align:center;color:#fff;}
.btn .default:hover{background-position:100% -120px;}
.btn .default:hover span{background-position:0 -80px;}
.btn .default:active{background-position:100% -200px;}
.btn .default:active span{background-position:0 -160px;}
.btn .default.disabled{background-position:100% -280px;}
.btn .default.disabled span{background-position:0 -240px;}
.btn .default.disabled em{color:#ccc;}
.btn .default.disabled,
.btn .default.disabled *{cursor:default;}
.btn .default.loading em{background:url(http://<?php echo IMG_HOST ?>/shopi/loading.gif) no-repeat 50% 50%;}
.btn .default.loading b{visibility:hidden;}

.btn_ok_s .default,
.btn_ok_s .default span{background-image:url(http://<?php echo IMG_HOST ?>/pici/btn_ok_s.png);}
.btn_ok_s .default em{line-height:21px;padding:0 3px;}
.btn_ok_m .default,
.btn_ok_m .default span{background-image:url(http://<?php echo IMG_HOST ?>/pici/btn_ok_m.png);}
.btn_ok_m .default em{line-height:25px;padding:0 10px;}
.btn_ok_b .default,
.btn_ok_b .default span{background-image:url(http://<?php echo IMG_HOST ?>/pici/btn_ok_b.png);}
.btn_ok_b .default em{line-height:29px;padding:0 14px;font-size:14px;}
.btn_ok_l .default,
.btn_ok_l .default span{background-image:url(http://<?php echo IMG_HOST ?>/pici/btn_ok_l.png);}
.btn_ok_l .default em{line-height:33px;font-size:14px;}
.btn_ok_l .default b{ padding:1px 22px 0;}
.btn_cancel_m .default,
.btn_cancel_m .default span{background-image:url(http://<?php echo IMG_HOST ?>/pici/btn_cancel_m.png);}
.btn_cancel_m .default em{line-height:25px;padding:0 10px;color:#333;}
.btn_cancel_b .default,
.btn_cancel_b .default span{background-image:url(http://<?php echo IMG_HOST ?>/pici/btn_cancel_b.png);}
.btn_cancel_b .default em{line-height:29px;padding:0 14px;font-size:14px;color:#333;}

/**@common
 * 弹出框box */
.dialog{background-color:rgba(0,0,0,.3);background-color:#b1b1b1\9;position:absolute;z-index:500;padding:6px;
    -webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;}
.panel-mask{position:fixed;top:0;left:0;z-index:450;width:100%;height:100%;background-color:#fff;opacity:.3;filter:alpha(opacity=30);}
.dialog_close,.dialog_title{background-image:url(http://<?php echo IMG_HOST ?>/pici/dialog_sprite.png);background-repeat:no-repeat;}
.dialog_close{position:absolute;top:6px;right:6px;width:38px;height:37px;background-position:0 0;}
.dialog_close:hover{background-position:-55px 0;}
.dialog_close:active{background-position:-105px 0;}
.dialog_title{height:35px;line-height:35px;padding:1px 12px 0 8px;background-position:0 -80px;background-repeat:repeat-x;border-bottom:1px solid #eaeaea;}
.dialog_title h2{font-size:14px;}
.dialog_bd{min-height:100px;_height:100px;background-color:#fff;}

.i_class,
.i_logo,
.i_ok,
.__logo{background-image:url(http://<?php echo IMG_HOST ?>/pici/plus_sprite-6.png);background-repeat:no-repeat;}
.i_class{background-position:-250px -120px;width:21px;height:21px;position:absolute;top:4px;left:4px;}
.i_logo{background-position:-215px -119px;width:25px;height:23px;margin:-3px 3px 0 0;}
.i_ok{background-position:-285px -120px;width:19px;height:15px;margin-top:-2px;}

/*图片收集设置*/
.pic_edit{width:552px;padding:35px 40px 40px;}
.pic_edit .ui_blk_left{width:123px;margin-right:15px;}
.pic_edit .pic_show_cnt{width:117px;height:115px;overflow:hidden;cursor:pointer;background-color:#f7f7f7;}
.pic_edit .triple .pic_show_cnt{padding:0;border:none;width:119px;height:118px;}
.pic_edit .triple .pic_show_cnt span{display:block;width:117px;height:116px;overflow:hidden;border:1px solid #bfbfbf;}
.pic_edit .triple .pic_show_cnt i{position:absolute;left:0;bottom:0;width:35px;height:35px;background:url(http://<?php echo IMG_HOST ?>/pici/ico_select.png) no-repeat;}
.pic_edit .triple .pic_show_cnt .selected{background-position:0 -45px;}
.pic_edit textarea{color:#333;display:block;width:342px;height:65px;font-size:14px;padding:4px 15px 4px 4px;margin:15px 0 20px;border:1px solid #ccc;}
.pic_edit .ui_page_slide{margin-top:5px;}
.pic_edit .ui_page_next{float:right;}
.pic_edit .row_opts{position:relative;}
.pic_edit .row_opts .r{margin-top:6px;margin-right:2px}
.pic_edit .row_opts .r a{margin-left:5px;}
.pic_edit .row_opts .error{left:-138px;top:0;margin-left:10px;}
.pic_edit .info{margin-top:5px;}
.pic_edit .info .price{color:#78c042;}
.pic_edit .suggest_wrap{width:348px;}

/**@common
 * 多图展示 */
.pic_show{display:inline-block;zoom:1;vertical-align:top;}
.pic_show .double,
.pic_show .double .bg_tp{background-image:url(http://<?php echo IMG_HOST ?>/pici/double_bg.png);background-repeat:no-repeat;}
.pic_show .triple,
.pic_show .triple .bg_tp{background-image:url(http://<?php echo IMG_HOST ?>/pici/multiple_bg.png);background-repeat:no-repeat;}
.pic_show .double,
.pic_show .triple{background-position:100% 100%;position:relative;}
.pic_show .bg_tp{background-position:100% 0;height:10px;position:absolute;top:0;right:0;}
.pic_show .pic_show_cnt{padding:1px;border:1px solid #bfbfbf;background-color:#fff;}
.pic_show .double .bg_tp{width:2px;}
.pic_show .double .pic_show_cnt{margin-right:2px;}
.pic_show .triple .bg_tp{width:4px;}
.pic_show .triple .pic_show_cnt{margin-right:4px;}
.pic_show .one .bg_tp{display:none;}

/*本页特别定义*/
.dialog{position:absolute;}
.pic_edit .link_select{width:233px;padding-left:8px;padding-top:3px;padding-bottom:3px;text-decoration:none;}
.pic_edit textarea{width:327px;}
.pic_edit .ui_page_slide{width:39px;float:right;}
.pic_edit .ui_blk_left{width:175px;margin-right:29px;}
.pic_edit .pic_show_cnt{width:170px;}
.pic_edit .row_album{z-index:100;}
.pic_edit .row_text{padding:15px 0 0;height:95px;}
.pic_edit .row_text textarea{margin:0;}
.pic_edit .row_opts .r a{cursor:pointer;}
.pic_edit .row_opts .btn{vertical-align:top;}
.pic_edit .row_opts .error{position:absolute;left:100px;line-height:31px;font-size:14px;}
.pic_edit .triple .pic_show_cnt{width:172px;}
.pic_edit .triple .pic_show_cnt span{width:170px;}
.pic_edit .disabled{color:#666;background-color:#fff;border-color:#ccc;}
.edit_tip{position:relative;top:-15px;font-size:14px;line-height:39px;padding:0 15px;background-color:#f9f9f9;border:1px solid #eaeaea;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;}
.i_dashbin{position:absolute;top:1px;right:1px;width:20px;height:21px;background:url(http://<?php echo IMG_HOST ?>/pici/plus_sprite-6.png) no-repeat 0 -179px;}
.i_dashbin:hover{background-position:0 -205px;}
.i_dashbin:active{background-position:0 -231px;}
.list_album{width:346px;}
.list_album .i_list_album{margin-top:-2px \9;}
.list_album .i_frdcomp, .list_album .i_lock2{top:8px;}
.list_album .ui_list_bd a{padding-top:7px;padding-bottom:8px;padding-top:8px \9;padding-bottom:7px \9;padding-left:8px;}
.list_album .ui_list_bd .on a,.list_album .ui_list_bd .on a:hover{border-bottom-color:#67bdd2;}
.list_album .input_text{width:260px!important;}
.pop_success{padding:60px 0 96px;width:632px;font-size:14px;text-align:center;}
.pop_successtip{padding:56px 0 !important;}
.tip_yellow{position:relative;*zoom:1;top:-18px;line-height:27px;font-size:14px;padding:0 10px 0 10px;background-color:#ffc;border:1px solid #fce587;}
.tip_yellow .i_close{width:8px;height:8px;margin-top:10px;background:url(http://<?php echo IMG_HOST ?>/pici/close_upfile.png) no-repeat;cursor:pointer;}
.list_album .input_text{padding:4px 3px 3px!important;}
.list_album .btn .default em{padding:0px;}
.list_album .error{width:250px;padding:1px 8px 0;margin:5px 0 2px;line-height:22px;font-size:14px;color:#dd4b39;background-color:#ffe5e5;border:1px solid #ffb7b7;}
.i_arrow {background: url("http://<?php echo IMG_HOST ?>/pici/spr_arrow.png") no-repeat scroll 0 0 transparent;display: inline-block;font-size: 0;height: 0;overflow: hidden;vertical-align: middle;width: 0;}
.list_album .btn .default b{padding:1px 0 0 12px}
/*切换账户*/
.user_opt{right:59px;top:7px;z-index:101;}
.opt_change,
.opt_exit,
.i_arrowdown,
.i_arrowup,
.opt_arrow{background-image:url(http://<?php echo IMG_HOST ?>/pici/plus_sprite-6.png);background-repeat:no-repeat;}
.opt_change{background-position:-20px -256px;width:12px;height:9px;display:block;}
.opt_exit{background-position:-40px -257px;width:11px;height:12px;display:block;}
.link_user_change{color:#666;position:relative;z-index:20;}
.link_user_change:hover{text-decoration:none;}
.user_opt .hover {text-decoration:none;}
.user_opt .hover .opt_arrow{background-position:0 -281px;}
.link_user_change .opt_arrow{width:19px;height:21px;margin:3px 0 0 3px;background-position:0 -257px;display:inline-block;zoom:1;font-size:0;overflow:hidden;vertical-align:middle;}
.list_change{padding:6px 0;top:28px;right:0;top:27px \9;_right:-1px;z-index:10;font-family:Arial;font-size:12px;width:91px;background-color:#f4f4f4;border:1px solid #bbb;-webkit-border-radius:3px 0 3px 3px;-moz-border-radius:3px 0 3px 3px;border-radius:3px 0 3px 3px;}
.list_change a{border-color:#f4f4f4;}
.list_change .ui_list_bd a{padding-left:27px;}
.list_change .ui_list_bd a i{position:absolute;top:7px;left:10px;}
.list_change .ui_list_bd a .opt_exit{top:6px;}
.list_change .ui_list_bd .on .opt_exit{top:5px;}
.list_change .ui_list_bd .on .opt_change{background-position:-20px -281px;}
.list_change .ui_list_bd .on .opt_exit{background-position:-40px -281px;}
/*切换价格链接下拉*/
.open_opt{height:13px;margin:23px 0 0;}
.i_arrowdown{background-position:-40px -160px;width:13px;height:13px;display:block;}
.i_arrowup{background-position:-40px -205px;width:13px;height:13px;display:block;}
.detail_form .input_text{font-size:14px;padding:10px 3px 7px 9px;width:332px;border:1px solid #ccc;}
.detail_form .input_text:-moz-placeholder { color: #999; }
/*手机*/
.plus_sprite{display:inline-block;zoom:1;height:0;width:0;font-size:0;overflow:hidden;vertical-align:middle;background-image:url(http://<?php echo IMG_HOST ?>/pici/plus_sprite-6.png);background-repeat:no-repeat;}
.i_phone{width:7px;height:12px;background-position:-60px -160px;margin:-2px 8px 0 0;}
.phone_tip{background:url(http://<?php echo IMG_HOST ?>/pici/plus_ft_bg.png) repeat;line-height:46px;text-align:center;}
.phone_tip a{color:#818181;text-shadow:0 1px 0 #fff;}
.phone_tip a:hover{color:#0092B5;text-decoration:none;}
.phone_tip a:hover .i_phone{background-position:-60px -205px;}
</style>

<?php
	echo Tool_CssJs::getJsHtml(array(
		'js/client/easyXDM.js',
		'js/base/Haibei.js',
		'js/core/jQuery.js',
	));
?>
</head>
<body>
    <div class="dialog dn abs" id="_j_pin" style="width:630px; left:159px">
        <a title="关闭" class="dialog_close _j_close" href="#"></a>
        <div class="dialog_title">
            <h2><!--<i class="dib vam i_logo"></i>-->收集到 chinadressshop</h2>
            <div class="abs user_opt f12 dn">
					<a class="link_user_change r _j_accounttrigger" href="#"><span id="_j_uaccount"></span><i class="opt_arrow"></i></a>
					<div class="ui_list list_change _j_accountopt dn">
						<ul class="ui_list_bd">
							<li class="_j_mdc" data-mdc="on"><a href="#" class="_j_switchaccount _j_mdpvd"><i class="opt_change"></i>切换账号</a></li>
							<li class="_j_mdc" data-mdc="on"><a href="#" class="_j_exitaccount _j_mdpvd"><i class="opt_exit"></i>退出登录</a></li>
						</ul>
					</div>
				</div>
        </div>
        <div class="dialog_bd fix">
            <div class="ui_blk pic_edit _j_pinbody">
                <div class="edit_tip _j_edittip dn">是否将相关的图片(<span class="_j_picnum"></span>P)都收集到开心集品？ 　　　　　　　
                    <a href="#" class="_j_all"><b>全部</b></a>
                    <span class="cd">|</span>
                    <a href="#" class="_j_single"><b>仅本张</b></a>
                </div>

                <div class="ui_blk_left">
                    <div class="_j_singlewrap" style="border:1px solid #BFBFBF; max-height:172px; min-height:85px; overflow:hidden"></div>
                    <div class="_j_multiplewrap pic_show" style="display:none">
                        <div class="_j_picwrap triple">
                            <div class="bg_tp"></div>
                            <div class="pic_show_cnt slide_wrap">
                                <div class="slide_container fix _j_slidewrap"></div>
                            </div>
                        </div>
                        <div class="ui_page_slide fix _j_pagination">
                            <span class="ui_status ui_page_prev"><a class="status_item disabled _j_prev" href="#">上一页</a></span>
                            <span class="ui_status ui_page_next"><a class="status_item _j_next" href="#">下一页</a></span>
                        </div>
                    </div>
                </div>
                <div class="ui_blk_cnt">
                    <div class="ui_form detail_form _j_detailform">
                        <input type="text" name="title" class="input_text" placeholder="添加标题" style="margin-top:0;">
						<input type="text" name="price" class="input_text detail_input1" placeholder="添加价格" style="width:100px;"><span style="font-family: arial;font-size:14px;">（￥）</span>
						<select name="categories" style="display:block;font-size:120%;margin-top:15px;">
							<option value="wedding gowns & dresses">wedding gowns & dresses</option>
							<option value="suits">suits</option>
						</select>
						<div style="margin-top:15px;font-size:120%">
						尺码：<input type="checkbox" name="size[]" value="S"/>S
							<input type="checkbox" name="size[]" value="M"/>M
							<input type="checkbox" name="size[]" value="L"/>L
							<input type="checkbox" name="size[]" value="XL"/>XL
							<input type="checkbox" name="size[]" value="XXL"/>XXL
							<input type="checkbox" name="size[]" value="XXXL"/>XXXL
						</div>
						<div style="margin-top:15px;font-size:120%">
						颜色：<input type="checkbox" name="color[]" value="red"/>红
							<input type="checkbox" name="color[]" value="blue"/>蓝
							<input type="checkbox" name="color[]" value="yellow"/>黄
							<input type="checkbox" name="color[]" value="green"/>绿
							<input type="checkbox" name="color[]" value="purple"/>紫
							<input type="checkbox" name="color[]" value="orange"/>橙
							<input type="checkbox" name="color[]" value="black"/>黑
							<input type="checkbox" name="color[]" value="white"/>白
						</div>
						<input type="text" name="sourceurl" class="input_text dn" placeholder="添加来源网页地址">
					</div>
                    <div class="row_text">
                        <div class="dib rel">
                        	<label class="abs f14 c9" id="_j_forpindesc" for="_j_pindesc" style="padding:5px 0 0 8px">添加描述</label>
                            <textarea class="_j_desc _j_placeholder" id="_j_pindesc" phid="_j_forpindesc"></textarea>
                            <a tabindex="-1" class="i_dashbin _j_cleararea dn" title="清空" href="#"></a>
                        </div>
                    </div>
                    <div class="row_opts fix">
                        <div class="r">
                            <div class="_j_shareicon">
                                <a tabindex="-1" class="i_kx dni" originclass="i_kx" title="将内容自动同步到开心网" entitle="将内容自动同步到开心网" distitle="点击即可将内容自动同步到开心网" shareid="1" href="#"></a>
                                <a tabindex="-1" class="i_sina dni" originclass="i_sina" title="将内容自动同步到新浪微博" entitle="将内容自动同步到新浪微博" distitle="点击即可将内容自动同步到新浪微博" shareid="2" href="#"></a>
                                <a tabindex="-1" class="i_qqweibo dni" originclass="i_qqweibo" title="将内容自动同步到腾讯微博" entitle="将内容自动同步到腾讯微博" distitle="点击即可将内容自动同步到腾讯微博" shareid="4" href="#"></a>
                                <a tabindex="-1" class="i_qqzone dni" originclass="i_qqzone" title="将内容自动同步到QQ空间" entitle="将内容自动同步到QQ空间" distitle="点击即可将内容自动同步到QQ空间" shareid="3" href="#"></a>
                                <a tabindex="-1" class="i_douban dni" originclass="i_douban" title="将内容自动同步到豆瓣" entitle="将内容自动同步到豆瓣" distitle="点击即可将内容自动同步到豆瓣" shareid="3" href="#"></a>
                            </div>
                        </div>
						<span class="btn btn_ok_l"><a class="default _j_pinsubmit" href="#" title="快捷键 Ctrl+Enter"><span><em><b>收集</b></em></span></a></span>
                        <span style="width:155px; display:none" class="error dib _j_errcnt"></span>
                    </div>
                </div>
            </div>
            <div class="pop_success _j_pinsuccess dn">
                <i class="dib vam i_ok"></i>&nbsp;收集成功!
                <a class="_j_showlink" target="_blank" href="#">去看看</a>
            </div>
            <div class="_j_selectionUsed dn" style="background:url(http://<?php echo IMG_HOST ?>/pici/plus_pop_success.gif) no-repeat 100% 0;">
				<img src="http://<?php echo IMG_HOST ?>/pici/plus_pop_movie.gif" alt="">
			</div>
            <div class="phone_tip _j_popularized dn">
                <a href="http://<?= PIC_NORMAL_WWW_HOST ?>/navi/iphone.php?_sfrom=plugin_to_iphone" target="_blank"><i class="plus_sprite i_phone"></i>开心集品iPhone客户端上线啦，立即查看&gt;&gt;</a>
            </div>
        </div>
    </div>
    <div style="width:630px; left:159px" class="dialog abs" id="_j_login">
        <a title="关闭" class="dialog_close _j_close" href="#"></a>
        <div class="dialog_title">
            <h2><!--<i class="dib vam i_logo"></i>-->登录到开心集品</h2>
        </div>
        <div class="dialog_bd fix">
            <div class="login">
                <form action="" class="login_form" action="#" id="loginform">
                    <div class="area">
                        <div class="row_text rel">
                            <label class="abs f14 c9" id="_j_foraccount" for="_j_account" style="padding:10px 0 0 10px">开心网账号</label>
                            <input type="text" name="account" autocomplete="off" id="_j_account" phid="_j_foraccount" class="_j_placeholder input_text _j_account rel" style="background:transparent" />
                            <div class="error _j_error dn"><span></span><i class="dib i_arrow"></i></div>
                        </div>
                        <div class="row_text rel">
                            <label class="abs f14 c9" id="_j_forpassword" for="_j_password" style="padding:10px 0 0 10px">密码</label>
                            <input type="password" name="password" autocomplete="off" id="_j_password" phid="_j_forpassword" class="_j_placeholder input_text _j_password rel" style="background:transparent" />
                            <div class="error _j_error dn"><span></span><i class="dib i_arrow"></i></div>
                        </div>
                        <div class="row_code _j_captcha dn rel">
                            <label class="abs f14 c9" id="_j_forcaptcha" for="_j_captchainput" style="padding:10px 0 0 10px">验证码</label>
                            <input type="text" name="captcha" autocomplete="off" id="_j_captchainput" phid="_j_forcaptcha" class="_j_placeholder input_text _j_captchainput" style="background:transparent" />
                            <img height="35" class="_j_captchaimg" width="91" alt="" src="" />
                            <input name="rcode" class="_j_rcode" type="hidden" />
                            <a class="dib vab _j_changeimg" href="#">换一张</a>
                            <div class="error _j_error"><span></span><i class="dib i_arrow"></i></div>
                        </div>
                        <div class="row_check">
                            <input type="checkbox" name="remember" value="1" id="rememberlogin" autocomplete="off" checked="checked" class="input_check vam">
                            <label class="vam" for="rememberlogin">记住登录身份</label>
                        </div>
                        <div class="row_button">
                            <input type="submit" value="" class="btn_submit">
                            <a target="_blank" href="http://www.kaixin001.com/reg/sendpass.php">忘记密码</a>
                        </div>
                    </div>
                </form>
            </div>
        </div>
    </div>
</body>

<?php
	echo Tool_CssJs::getJsHtml(array(
		'js/core/Select.js',
		'js/core/Slide.js',
		'js/core/Caret.js',
		'js/core/popup/HoverTip.js',
		'js/apps/common/PriceSuggestion.js',
		'js/apps/common/AtSuggestion.js',
		'js/apps/common/AClickHandler.js'
	), true);
?>

<script type="text/javascript">

document.domain = "<?php echo ROOT_HOST ?>";

// JSON
if(window.Prototype) {
    delete Object.prototype.toJSON;
    delete Array.prototype.toJSON;
    delete String.prototype.toJSON;
}
if(!this.JSON){this.JSON={}}(function(){function f(n){return n<10?"0"+n:n}if(typeof Date.prototype.toJSON!=="function"){Date.prototype.toJSON=function(key){return isFinite(this.valueOf())?this.getUTCFullYear()+"-"+f(this.getUTCMonth()+1)+"-"+f(this.getUTCDate())+"T"+f(this.getUTCHours())+":"+f(this.getUTCMinutes())+":"+f(this.getUTCSeconds())+"Z":null};String.prototype.toJSON=Number.prototype.toJSON=Boolean.prototype.toJSON=function(key){return this.valueOf()}}var cx=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,escapable=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,gap,indent,meta={"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},rep;function quote(string){escapable.lastIndex=0;return escapable.test(string)?'"'+string.replace(escapable,function(a){var c=meta[a];return typeof c==="string"?c:"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+string+'"'}function str(key,holder){var i,k,v,length,mind=gap,partial,value=holder[key];if(value&&typeof value==="object"&&typeof value.toJSON==="function"){value=value.toJSON(key)}if(typeof rep==="function"){value=rep.call(holder,key,value)}switch(typeof value){case"string":return quote(value);case"number":return isFinite(value)?String(value):"null";case"boolean":case"null":return String(value);case"object":if(!value){return"null"}gap+=indent;partial=[];if(Object.prototype.toString.apply(value)==="[object Array]"){length=value.length;for(i=0;i<length;i+=1){partial[i]=str(i,value)||"null"}v=partial.length===0?"[]":gap?"[\n"+gap+partial.join(",\n"+gap)+"\n"+mind+"]":"["+partial.join(",")+"]";gap=mind;return v}if(rep&&typeof rep==="object"){length=rep.length;for(i=0;i<length;i+=1){k=rep[i];if(typeof k==="string"){v=str(k,value);if(v){partial.push(quote(k)+(gap?": ":":")+v)}}}}else{for(k in value){if(Object.hasOwnProperty.call(value,k)){v=str(k,value);if(v){partial.push(quote(k)+(gap?": ":":")+v)}}}}v=partial.length===0?"{}":gap?"{\n"+gap+partial.join(",\n"+gap)+"\n"+mind+"}":"{"+partial.join(",")+"}";gap=mind;return v}}if(typeof JSON.stringify!=="function"){JSON.stringify=function(value,replacer,space){var i;gap="";indent="";if(typeof space==="number"){for(i=0;i<space;i+=1){indent+=" "}}else{if(typeof space==="string"){indent=space}}rep=replacer;if(replacer&&typeof replacer!=="function"&&(typeof replacer!=="object"||typeof replacer.length!=="number")){throw new Error("JSON.stringify")}return str("",{"":value})}}if(typeof JSON.parse!=="function"){JSON.parse=function(text,reviver){var j;function walk(holder,key){var k,v,value=holder[key];if(value&&typeof value==="object"){for(k in value){if(Object.hasOwnProperty.call(value,k)){v=walk(value,k);if(v!==undefined){value[k]=v}else{delete value[k]}}}}return reviver.call(holder,key,value)}text=String(text);cx.lastIndex=0;if(cx.test(text)){text=text.replace(cx,function(a){return"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4)})}if(/^[\],:{}\s]*$/.test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]").replace(/(?:^|:|,)(?:\s*\[)+/g,""))){j=eval("("+text+")");return typeof reviver==="function"?walk({"":j},""):j}throw new SyntaxError("JSON.parse")}}}());

K.App('ARemote', ['core/jQuery', 'core/Select', 'core/Slide', 'core/Caret', 'core/popup/HoverTip', 'apps/common/PriceSuggestion', 'apps/common/AtSuggestion']).define(function(require) {

    var $ = require('core/jQuery'),
        Select = require('core/Select'),
        Slide = require('core/Slide'),
        Caret = require('core/Caret'),
        HoverTip = require('core/popup/HoverTip'),
        PriceSuggestion = require('apps/common/PriceSuggestion'),
        AtSuggestion = require('apps/common/AtSuggestion'),

        ErrTip = {
            '11003' : ['请选择格架'],
            '12002' : ['请添加描述'],
            '12003' : ['链接有误，请重输', '._j_detailsetting'],
            '12011' : ['价格格式有误', '._j_detailsetting'],
            '14001' : ['图片暂时无法获取'],
            '14003' : ['收集失败，图片尺寸过小'],
            '99999' : ['服务器正忙，请稍后再试'],

            'default' : ['收集失败，服务器错误', '._j_password'],

            '10001' : ['用户名或密码错误', '._j_password'],
            '10002' : ['由于您连续输入错误，需要输入验证码', '._j_captchainput'],
            '10003' : ['验证码错误，请重新输入', '._j_captchainput'],
            '10004' : ['该账号已被冻结，请联系客服', '._j_password'],
            '10999' : ['请输入账号', '._j_account'],
            '10998' : ['请输入密码', '._j_password'],
            '10997' : ['请输入验证码', '._j_captchainput'],
            '100002' : ['账户不存在', '._j_account'],

            // 格架
            '1' : ['请输入格架名'],
            '11007' : ['该格架名称已存在']
        };

    return {

        'events' : {},

        'main' : function() {
            this.albumData = null;
            this.userInfo = null;

            this.createXDM();
            this.setEventsElement();
            this.bindEvents();
            this.initAjaxErrHandler();
            //this.showPanel();
        },

        /**
         * 创建与客户浏览器通信socket
         */
        'createXDM' : function() {
            this.socket = new easyXDM.Socket({
                onMessage: function(message, origin){
                    //alert(message);
                    message = JSON.parse(message);
                    if(message.event) {
                        K.fire(message.event, {'data':message.data});
                    }
                }
            });
        },

        /**
         * 常用元素提前保存
         */
        'setEventsElement' : function() {
            this.login = $('#_j_login');
            this.pinDialog = $('#_j_pin');

            this.detailForm = this.pinDialog.find('._j_detailform');
            this.detailSettingTrigger = this.pinDialog.find('._j_detailsetting');

            this.albumList = this.pinDialog.find('._j_albumlist');
            this.albumWrap = this.pinDialog.find('._j_albumwrap');
            this.albumDropTrigger = this.albumWrap.children('._j_albumdroptrigger');
            this.albumListCnt = this.albumList.parent();
            this.albumValueBox = this.albumDropTrigger.children('._j_valuebox');
            this.albumInput = this.albumWrap.find('._j_newalbuminput');

            this.pinDesc = this.pinDialog.find('._j_desc');
            this.pinSubmit = this.pinDialog.find('._j_pinsubmit');
            this.editTip = this.pinDialog.find('._j_edittip');
            this.singlePicWrap = this.pinDialog.find('._j_singlewrap');
            this.multiplePicWrap = this.singlePicWrap.next('._j_multiplewrap');
            this.clearArea = this.pinDialog.find('._j_cleararea');
            this.errCnt = this.pinDialog.find('._j_errcnt');
            this.captcha = this.login.find('._j_captcha');
            this.captchaImg = this.captcha.children('._j_captchaimg');
            this.captchaLink = this.captcha.children('._j_changeimg');
            this.captchaRcode = this.captcha.children('._j_rcode');
        },

        'bindEvents' : function() {
            var _this = this;

            K.on('giflog', $.proxy(function(data) {
		    	if(data.key && !data.params) {
		    		this.log1(data.key);
		    	} else if(data.key && data.params) {
		    		if(data.withUid) {
		    			data.params['uid'] = Cookie.get('_kxcapiuid');
		    		}
		    		this.log2(data.key, data.params);
		    	}
		    }, this));

            // 监听pin pic事件
            K.on('request:pinpic', $.proxy(this.preparePin, this));

            // 文本域suggestion(圈人@和加个符号suggestion)
            this.initAreaSuggestion();

            // pin submit事件
            this.pinSubmit.bind('click', $.proxy(this.savePin, this));

            // 描述框事件
            this.pinDesc.bind('keydown', $.proxy(this.listenDescKey, this));
            this.pinDesc.listenInput($.proxy(function(ev) {
                var val = this.pinDesc.val();
                if(K.byteLen(val) > 20000) {
                    var scrollTop = this.pinDesc.get(0).scrollTop;
                    this.pinDesc.val(K.subByte(val, 20000));
                    this.pinDesc.scrollTop(scrollTop);
                } else if(val === '') {
                    this.clearArea.addClass('dn');
                }
            }, this));

            // 发布关闭事件
            $(document).keyup($.proxy(function(ev) {
				if(ev.keyCode === 27) {
					this.socket.postMessage(JSON.stringify({'event':'action:closedialog'}));
				}
			}, this));
            $('._j_close').click($.proxy(function(ev) {
            	try {
            		this.pinXHR && this.pinXHR.abort();
            	} catch(e) {}
                this.socket.postMessage(JSON.stringify({'event':'action:closedialog'}));
                ev.preventDefault();
            }, this));

            // 关闭已pin的提示黄条
            this.pinDialog.delegate('._j_closepined', 'click', function(ev) {
                $(ev.currentTarget).parent().slideUp();
                ev.preventDefault();
            });

            // 打开dialog之后，自动聚焦到用户账户
            K.on('response:showdialog', $.proxy(function() {
            	var focusItem = this.userInfo ? this.pinDesc : $('#_j_account');
                setTimeout(function() {
                    focusItem.trigger('focus');
                }, 20);

                if(focusItem === this.pinDesc) {
                	this.focusPinDesc();
                }

            }, this));

            // 验证码获取
            this.captcha.children('._j_captchaimg, ._j_changeimg').click($.proxy(this.loadCaptchaImg, this));

            // 提交错误信息消失时机
            $('._j_placeholder').bind('input propertychange', function(ev) {
                var target = $(ev.currentTarget),
                    phid = target.attr('phid');
                target.siblings('._j_error').hide();
                if(target.val() && phid) {
                    $('#'+phid).hide();
                } else if(!target.val() && phid) {
                    $('#'+phid).show();
                }
            }).listenInput(function(ev) {
                var target = $(ev.currentTarget),
                    phid = target.attr('phid');
                target.siblings('._j_error').hide();
                if(target.val() && phid) {
                    $('#'+phid).hide();
                } else if(!target.val() && phid) {
                    $('#'+phid).show();
                }
            });

            // 登陆表单
            var loginForm = $('#loginform');
            loginForm.submit(function(ev) {
                _this.formValid($.proxy(function() {
                    $.post('/login/login', $(this).serialize(), function(data) {
                        data = $.parseJSON(data);
                        if(!data.error) {
                            _this.needCaptcha = false;
                            _this.userInfo = data.uinfo;
                            _this.showPin();
                        } else {
                            _this.handleFormErr(data);
                        }
                    });
                }, this));
                ev.preventDefault();
            });

			// 重新绑定enter提交form，防止ie下不能提交的种种问题
			if($.browser.msie) {
	            loginForm.find('input._j_placeholder').bind('keydown', function(ev) {
	                if(ev.keyCode === 13) {
	                	ev.preventDefault();
	                    loginForm.trigger('submit');
	                }
	            });
			}

            // 分享图标点击事件
            this.pinDialog.delegate('._j_shareicon a', 'click', function(ev) {
                var target = $(ev.currentTarget),
                    originClass = target.attr('originclass'),
                    disableClass = originClass+'_dis';

                if(!target.data('selected')) {
                    target.removeClass(disableClass).addClass(originClass);
                    target.data('selected', true);
                    target.attr('title', target.attr('entitle'));
                } else {
                    target.removeClass(originClass).addClass(disableClass);
                    target.removeData('selected');
                    target.attr('title', target.attr('distitle'));
                }
                ev.preventDefault();
            });

            // 删除文本框内容
            this.clearArea.click($.proxy(function(ev) {
                this.pinDesc.val('').focus();
                this.clearArea.addClass('dn');
                ev.preventDefault();
            }, this)).mousedown(function(ev) {
                $(this).addClass('clicked');
            }).mouseup(function(ev) {
                $(this).removeClass('clicked');
            });

            // 多图提示
            this.editTip.children('._j_all').click($.proxy(function(ev) {
                this.setMutiplePic();
                this.editTip.slideUp();
                ev.preventDefault();
            }, this));
            this.editTip.children('._j_single').click($.proxy(function(ev) {
                this.editTip.slideUp();
                ev.preventDefault();
            }, this));

            // 展开详细设置表单（price、 source url）
            this.detailSettingTrigger.bind('click', $.proxy(function(ev) {
            	var target = $(ev.currentTarget);
            	if(target.hasClass('i_arrowdown')) {
            		target.removeClass('i_arrowdown').addClass('i_arrowup');
            		this.detailForm.show()
            	} else {
            		target.removeClass('i_arrowup').addClass('i_arrowdown');
            		this.detailForm.hide()
            	}
            }, this));
            this.detailSettingTrigger.bind('error', function(ev) {
            	var target = $(ev.currentTarget);
            	if(target.hasClass('i_arrowdown')) {
            		target.trigger('click');
            	}
            });

            // 显示切换账户弹出层
            var accountChange = new HoverTip({
            	'selector' : '._j_accounttrigger',
                'context' : '#_j_pin',
                'showWait' : 80,
                'hideWait' : 30,
                'showTime' : 0,
                'hideTime' : 0,
                'setTip' : function(trigger) { return trigger.next('._j_accountopt'); }
            });
            accountChange.on('beforeshow', function(data) {
                data.trigger.addClass('hover');
            });
            accountChange.on('afterhide', function(data) {
                data.trigger.removeClass('hover');
            });

            // 切换账户
            this.pinDialog.delegate('._j_switchaccount', 'click', $.proxy(function(ev) {
            	$.post('/login/logout', $.proxy(function(data) {
            		data = $.parseJSON(data);
            		if(!data.error) {
            			this.exitLogin();
            		} else {
            			K.log('Data Err:', data.error);
            		}
            	}, this));
            	ev.preventDefault();
            }, this));

            // 退出登录
            this.pinDialog.delegate('._j_exitaccount', 'click', $.proxy(function(ev) {
            	$.post('/login/logout', $.proxy(function(data) {
            		data = $.parseJSON(data);
            		if(!data.error) {
            			this.exitLogin();
            			setTimeout($.proxy(function() {
            				this.socket.postMessage(JSON.stringify({'event':'action:closedialog'}));
            			}, this), 600);
            		} else {
            			K.log('Data Err:', data.error);
            		}
            	}, this));
            	ev.preventDefault();
            }, this));
        },

        'initAjaxErrHandler' : function() {
            $('body').ajaxError($.proxy(function( event, jqXHR ) {
                if(jqXHR.status === 401) {
                    this.exitLogin();
                }
            }, this));
        },

        'exitLogin' : function() {
        	this.clearUserData();
            this.showLogin();
        },

        'clearUserData' : function() {
        	this.userInfo = null;
        	this.albumData = null;
        },

        'showLogin' : function() {
        	this.pinDialog.find('._j_accountopt').css('display', 'none');
            this.pinDialog.addClass('dn');
            this.captcha.css('display', 'none');
            this.login.removeClass('dn');
            $('#_j_password').val('');
            $('#_j_account').val('');
            setTimeout(function() {
            	try {
            		$('#_j_password').trigger('input');
            		$('#_j_account').trigger('input').trigger('focus');
            	} catch(e) { K.log(e); }
            }, 100);
            K.fire('pin:prepared');
        },

        /**
         * 准备pin(判断login)
         */
        'preparePin' : function(args) {

            var data = args.data;

            // 获取等待pin的图片相关信息
            this.pinPicInfo = data.picinfo;
            this.waitPin();
            this.getUInfo();

            // 绑定远程回调弹出pin对话框
            K.once('pin:prepared', $.proxy(function() {
            	this.socket.postMessage(JSON.stringify({'event':'response:pinpic', 'data':{'errno':0}}));
            }, this));
        },

        /**
         * 获得用户信息
         */
        'getUInfo' : function(callback) {
        	callback = typeof callback === 'function' ? callback : $.noop;
        	var _this = this;
        	$.ajax({
        		'url' : '/user/me',
        		'type' : 'GET',
        		'dataType' : 'json',
        		'success' : function(data) {
        			_this.userInfo = data;
        			K.fire('plug:login');
        			callback();
        		},
        		'error' : function() {
        			callback();
        		}
        	})
        },

        'waitPin' : function() {
        	if(this.waiting) return;
        	this.waiting = true;
            K.once('plug:login', $.proxy(function() {
            	this.waiting = false;
                this.showPin();
            }, this));
        },

        /**
         * 获得album，showPin
         */
        'showPin' : function() {
            this.pinPic();
        },

        /**
         * 真正进行pin面板的构建
         */
        'pinPic' : function() {
            // 设置pin的图片
            //this.loadLastPin();
            //this.loadShareTo();
            this.clear();
            this.setPic();

            this.login.addClass('dn');
            this.pinDialog.removeClass('dn');
            this.focusPinDesc();

            K.fire('pin:prepared');
        },

        'initAreaSuggestion' : function() {

        	// price 单位输入监听
            new PriceSuggestion({'area' : this.pinDesc, 'source' : 'plug'});

            // price 单位输入监听，针对隐藏的price input
            new PriceSuggestion({'area' : this.detailForm.children('input[name="price"]'), 'source' : 'plug', 'focusShow':true});

            // at人名
            new AtSuggestion({
            	'source' : 'plug',
            	'area' : this.pinDesc,
            	'URL' : '/friend/suggest',
				// 由于数据和jipin网站的封装的不一致性，重写此处的ajax数据处理
		        'xhr' : function(param, callback) {
		        	var _this = this;
		        	return $.get(this.URL+'?t='+(+new Date) , param, function(data) {
		                try {
		                    data = $.parseJSON(data);
		                    if(!data.error) {
		                        _this.cache.put(JSON.stringify(param), data);
		                        callback(data);
		                    } else {
		                        K.log('Data Err:', data);
		                    }
		                } catch(e) {
		                    K.log('Exception:', e);
		                    callback();
		                }
		            });
		        }
            });

        },

        'loadLastPin' : function() {

            // 查看当前src有没有被pin过
            this.pinDialog.find('._j_pinedinfo').remove();
            //pinedInfo.css('display', 'none');
            //pinedInfo.css('visiblity', 'hidden');

            $.get('/photo/src2pin', {'src':this.parseSrc(this.pinPicInfo.targetImg.src)}, $.proxy(function(data) {
                data = $.parseJSON(data);
                var pinedDate = data.ctime.split(' ')[0],
                    pinedDateArr = pinedDate.split('-'),
                    pinedAlbum = this.getAlbumById(data.aid);

                if(!this.pinDialog.find('._j_pinedinfo').length) {
                	pinedInfo = $('<div class="tip_yellow _j_pinedinfo dn"><a class="i_close r _j_closepined" href="#"></a><span>提示：你曾于'+pinedDateArr[1]+'月'+pinedDateArr[2]+'日上传此收集到格架“'+K.subByte(pinedAlbum, 23, '...')+'”</span></div>').prependTo(this.pinDialog.find('._j_pinbody'));
                	pinedInfo.slideDown();
                }
            }, this));
        },

        'loadShareTo' : function() {
            $.get('/user/me/syncs', $.proxy(function(data) {
                data = $.parseJSON(data);
                if(!data.error) {
                    this.genShareHTML(data);
                } else {
                    K.log('load share to error:', data);
                }
            }, this));
        },

        'genShareHTML' : function(data) {
            var html = '';
            for(var i=0,len=data.length; i<len; i++) {
                var item = data[i];
                if(item.user && item.user.binded) {
                    var target = $('.i_'+item.code);
                    target.removeClass('dni');
                    if(item.user.share) {
                        target.data('selected', true).removeClass('i_'+item.code+'_dis').addClass('i_'+item.code).attr('title', target.attr('entitle'));
                    } else {
                        target.data('selected', false).removeClass('i_'+item.code).addClass('i_'+item.code+'_dis').attr('title', target.attr('distitle'));
                    }
                }
            }
        },

        'getAlbumById' : function(aid) {
            for(var i=0, len=this.albumData.length; i<len; i++) {
                if(this.albumData[i].aid === aid) {
                    return this.albumData[i].title;
                }
            }
        },

        'focusPinDesc' : function() {
        	var descLength = this.pinDesc.val().length;
			setTimeout($.proxy(function() {
				try {
					this.pinDesc.trigger('focus');
					if(descLength > 0) {
						Caret.setCaretPosition(this.pinDesc, descLength, descLength);
					}
				} catch(e) {}
	       }, this), 50);
        },

        'clear' : function() {
            this.pinDesc.val('');
            this.clearArea.addClass('dn');
            this.errCnt.css('display', 'none');
            this.pinSubmit.removeClass('loading disabled');
            this.pinDialog.find('._j_pinbody').removeClass('dn');
            this.pinDialog.find('._j_pinsuccess').addClass('dn').siblings('._j_selectionUsed, ._j_popularized').addClass('dn');
        },

        /**
         * 监听描述框中的key事件
         */
        'listenDescKey' : function(ev) {
            if(ev.ctrlKey && ev.keyCode === 13) {
                this.pinSubmit.trigger('click');
            }
        },

		/**
		 * 获取主照片
		 */
        'getMainPicture' : function() {
        	
        	return this.pinPicInfo.pic;
        	
            var _this = this;
            this.pinDialog.find('._j_pinimg').each(function() {
                var $this = $(this);
                return _this.parseSrc($this.attr('src'))
            });
            return '';
        },
        
		/**
		 * 获取其他照片
		 */
		'getPictures' : function() {
			return this.pinPicInfo.images;
		},

		'getGoodsSize' : function() {
			var result = [];
			this.detailForm.find('input[name="size[]"]').each(function(){
				if ( $(this).attr('checked') ) {
					result.push($.trim($(this).val()));
				}
			});
			return result.join(';');
		},

		'getGoodsColor' : function() {
			var result = [];
			this.detailForm.find('input[name="color[]"]').each(function(){
				if ( $(this).attr('checked')) {
					result.push($.trim($(this).val()));
				}
			});
			return result.join(';');
		},

        /**
         * 保存pin
         */
        'savePin' : function(ev) {
            var target = $(ev.currentTarget);

            if(!target.hasClass('loading')) {
                var desc = $.trim(this.pinDesc.val());
                if(desc.length > 0) {
                    // pin 内容
                    var saveData = {
					    'store' : 'admin',
					    'type' : 'Simple Product',
					    'sku' : 'dsc002dddAAAljkladf',
					    'attribute_set' : 'Default',
					    'manufacturer' : 'www.taobao.com',
					
					    'name' : $.trim(this.detailForm.children('input[name="title"]').val()) || this.pinPicInfo.title,
					    'description' : this.pinPicInfo.desc,
					    'categories' : $.trim(this.detailForm.children('select[name="categories"]').val()),
					    'size' : this.getGoodsSize(),
					    'color' : this.getGoodsColor(),
					    'price' : $.trim(this.detailForm.children('input[name="price"]').val()),
					    'cost' : $.trim(this.detailForm.children('input[name="price"]').val()),
					    'image' : this.getMainPicture(),
					    'small_image' : this.getMainPicture(),
					    'thumbnail' : this.getMainPicture(),
					    'gallery' : this.getPictures(),
                        'url' : encodeURI(this.pinPicInfo.url),

                        //'aid' : this.albumSelect.value,
                        //'siteids' : this.getShareTo(),
                    };

                    // 按钮loading状态
                    target.addClass('loading disabled');
                    this.clearArea.addClass('dn'); // 发送后自动影藏清空按钮
                    this.pinDesc.addClass('disabled').get(0).disabled = true;
                    this.albumDropTrigger.addClass('disabled');

                    this.pinXHR = $.ajax({
                        'url' : 'http://www.chinadressshop.com/magmi/integration/web/import.php',
                        'type' : 'POST',
                        'data' : saveData,

                        'complete' : $.proxy(function() {

                            // 状态恢复
                            target.removeClass('loading disabled');
                            this.pinDesc.removeClass('disabled').get(0).disabled = false;
                            this.albumDropTrigger.removeClass('disabled');

                        }, this),

                        'success' : $.proxy(function(data) {
							try {
								data = $.parseJSON(data);
							} catch(e) {}

                            if(!data.error) {
                                var pinSuccess = this.pinDialog.find('._j_pinsuccess');
                                this.pinDialog.find('._j_pinbody').addClass('dn');

                                // 准备底部部分提醒和推广信息
                                this.showPostTip($.proxy(function(time) {

                                    // 自动关闭：调用与否与推广的性质相关
                                    setTimeout($.proxy(function() {
                                        this.socket.postMessage(JSON.stringify({'event':'action:closedialog'}));
                                    }, this), time);

                                }, this));

                                // 显示成功图层
                                pinSuccess.removeClass('dn');
                                pinSuccess.find('._j_showlink').attr('href', 'http://<?= PIC_NORMAL_WWW_HOST ?>/p/'+data.pinid+'?_sfrom=plugin');

                                // 记录当前pin日志
                                this.logPin()
                            } else {
                                this.handleErr(data.error.errno);
                            }
                        }, this),

                        'error' : $.proxy(function() { this.handleErr(99999); }, this)
                    });
                } else {
                    this.handleErr(12002);
                }
            }
            ev.preventDefault();
        },

        'showPostTip' : function(callback) {
            var pinSuccess = this.pinDialog.find('._j_pinsuccess');
            if(this.selectionUsed) {
                pinSuccess.addClass('pop_successtip');
                pinSuccess.siblings('._j_selectionUsed').addClass('dn');
                pinSuccess.siblings('._j_popularized').removeClass('dn');

                // 检测推广
                if(this.popularized) {
                    callback(1000);
                } else {
                    $.post('/plugin/setting/popularize/update', {'value':1});
                    callback(1000);
                }
            } else {
                pinSuccess.addClass('pop_successtip');
                pinSuccess.siblings('._j_popularized').addClass('dn');
                pinSuccess.siblings('._j_selectionUsed').removeClass('dn');
                $.post('/plugin/setting/selection_display/update', {'value':1});
                callback(1000);
            }
        },

        'formValid' : function(callback) {
            var account = $.trim(this.login.find('._j_account').val()),
                password = this.login.find('._j_password').val(),
                captcha = $.trim(this.captcha.children('._j_captchainput').val()),
                isValid = false, errno;

            // 不需要验证码时，不提交验证码
            if(!this.needCaptcha) {
            	this.captcha.children('._j_captchainput').val('');
            	this.captcha.children('._j_rcode').val('');
            }

            if(account === '') {
                errno = 10999;
            } else if(password === '') {
                errno = 10998;
            } else if(this.needCaptcha && captcha === '') {
                errno = 10997;
            } else {
                callback();
            }
            if(errno) {
                this.handleFormErr({'error' : {'errno' : errno}});
            }
        },

        'handleFormErr' : function(data) {
            var error = data.error,
                errno = error.errno,
                errmsg = (ErrTip[errno] || ErrTip['default'])[0];

            // login err
            if(errno === 10001 && this.needCaptcha) {
                this.loadCaptchaImg();
            } else if(errno == 10002) {
                this.captcha.slideDown();
                this.rcode = data.rcode;
                this.loadCaptchaImg();
                this.captchaRcode.val(this.rcode);
                this.needCaptcha = true;
            } else if(errno == 10003) {
                this.captcha.slideDown();
                this.loadCaptchaImg();
            } else if(errno == 10997) {
                this.captcha.slideDown();
            }

            var errorTarget = this.login.find((ErrTip[errno]||ErrTip['default'])[1]);
            this.login.find('._j_error').hide();

            // 需要验证码的时候不提示错误信息
            if(errno != 10002) {
                errorTarget.siblings('._j_error').show().children('span').text(errmsg);
            }

            // 如果是验证码input框，则清除其内容
            if(errorTarget.hasClass('_j_captchainput')) {
                errorTarget.val('');
            }

            errorTarget.focus().select();
        },

        'handleAlbumErr' : function(errno) {
            var errmsg = (ErrTip[errno] || ErrTip['default'])[0],
                errCnt = this.albumWrap.find('._j_albumerr');

            errCnt.text(errmsg).slideDown();
            setTimeout($.proxy(function() {
                errCnt.slideUp();
            }, this), 2000);
        },

        'handleErr' : function(errno) {
            var errmsg = (ErrTip[errno] || ErrTip['default'])[0];

			// 针对于表单隐藏的price和source url元素，如果报错，需要展开
			if(ErrTip[errno] && ErrTip[errno][1]) {
				this.pinDialog.find(ErrTip[errno][1]).trigger('error');
			}

            this.errCnt.text(errmsg).show();
            setTimeout($.proxy(function() {
                this.errCnt.fadeOut(200);
            }, this), 2000);
        },

        'loadCaptchaImg' : function(ev) {
            if(this.rcode) {
                this.captchaImg.attr('src', '/login/captchaimg?rcode='+this.rcode+'&t='+(+new Date));
            }
            ev && ev.preventDefault();
        },

        /**
         * 获得pin图片数据
         */
        'getPinPic' : function() {
            var picPic = [],
                _this = this;
            this.pinDialog.find('._j_pinimg').each(function() {
                var $this = $(this);
                picPic.push({
                    'src' : _this.parseSrc($this.attr('src')),
                    'title' : $this.attr('title'),
                    'alt' : $this.attr('alt')
                });
            });

            return JSON.stringify(picPic);
        },

        /**
         * 对一些图片地址进行转化，期望得到更大的图片
         */
        'parseSrc' : function(src) {
            var host = this.getDomain(src),
                changeReg = {
                    'ww3.sinaimg.cn' : [/\/bmiddle\//, '/large/'],
                    'ww4.sinaimg.cn' : [/\/bmiddle\//, '/large/'],
                    't1.qpic.cn' : [/\/\d+$/, '/2000'],
                    't3.qpic.cn' : [/\/\d+$/, '/2000'],
                    'img3.douban.com' : [/\/median\//, '/raw/'],
                    'pic.kaixin001.com.cn' : [/(-)home(\*)/, '$1$2'],
                    'media-cdn.pinterest.com' : [/_b\.jpg/, '_f.jpg'],
                    's1.mogujie.cn' : [/_\d+x\d+\.jpg$/, ''],
                    's2.mogujie.cn' : [/_\d+x\d+\.jpg$/, ''],
                    's3.mogujie.cn' : [/_\d+x\d+\.jpg$/, ''],
                    's4.mogujie.cn' : [/_\d+x\d+\.jpg$/, ''],
                    's5.mogujie.cn' : [/_\d+x\d+\.jpg$/, ''],
                    's6.mogujie.cn' : [/_\d+x\d+\.jpg$/, ''],
                    's7.mogujie.cn' : [/_\d+x\d+\.jpg$/, ''],
                    's8.mogujie.cn' : [/_\d+x\d+\.jpg$/, ''],
                    's9.mogujie.cn' : [/_\d+x\d+\.jpg$/, ''],
                    'imgtest.meiliworks.com' : [/\/pic\/r\//, '/pic/_o/'],
                    'imgst-dl.meilishuo.net' : [/\/pic\/r\//, '/pic/_o/'],
                    'imgtest-lx.meilishuo.net' : [/\/pic\/r\//, '/pic/_o/'],
                    'imgtest-dl.meiliworks.com' : [/\/pic\/r\//, '/pic/_o/'],
                    'imgst-dl.meiliworks.com' : [/\/pic\/r\//, '/pic/_o/'],
                    'img-tx.meilishuo.net' : [/\/pic\/r\//, '/pic/_o/'],
                    'cdn.duitang.com' : [/\.thumb\.200_0/, ''],
                    'img2.duitang.com' : [/\.thumb\.200_0/, ''],
                    'img.hb.aicdn.com' : [/_fw192$/, '_fw554'],
                    'www.mishang.com' : [/_p\.jpg$/, '.jpg'],
                    'pic.yupoo.com' : [/metal\.jpg$/, 'wood.jpg'],
                    'ia.topit.me' : [/a[tm]\.jpg/, 'al.jpg'],
                    'ib.topit.me' : [/b[tm]\.jpg/, 'bl.jpg'],
                    'ic.topit.me' : [/c[tm]\.jpg/, 'cl.jpg'],
                    'id.topit.me' : [/d[tm]\.jpg/, 'dl.jpg'],
                    'ie.topit.me' : [/e[tm]\.jpg/, 'el.jpg'],
                    'if.topit.me' : [/f[tm]\.jpg/, 'fl.jpg'],
                    'i0.topit.me' : [/0[tm]\.jpg/, '0l.jpg'],
                    'i1.topit.me' : [/1[tm]\.jpg/, '1l.jpg'],
                    'i2.topit.me' : [/2[tm]\.jpg/, '2l.jpg'],
                    'i3.topit.me' : [/3[tm]\.jpg/, '3l.jpg'],
                    'i4.topit.me' : [/4[tm]\.jpg/, '4l.jpg'],
                    'i5.topit.me' : [/5[tm]\.jpg/, '5l.jpg'],
                    'i6.topit.me' : [/6[tm]\.jpg/, '6l.jpg'],
                    'i7.topit.me' : [/7[tm]\.jpg/, '7l.jpg'],
                    'i8.topit.me' : [/8[tm]\.jpg/, '8l.jpg'],
                    'i9.topit.me' : [/9[tm]\.jpg/, '9l.jpg'],
                    'i11.topit.me' : [/\.topit\.me\/[tm]\//, '.topit.me/l/'],
                    'i12.topit.me' : [/\.topit\.me\/[tm](\d+)\//, '.topit.me/l$1/']
                },
                reg = changeReg[host];
            if(reg) {
                src = src.replace(reg[0], reg[1]);
            }
            return src;
        },

        'getDomain' : function(url) {
        	var link = document.createElement('a');
        	link.href = url;
        	var host = link.host;
        	link = null;
        	return host.replace(/:[\d]+/, '');
        },

        /**
         * 获得share数据
         */
        'getShareTo' : function() {
            var shareids = [];
            this.pinDialog.find('._j_shareicon a').each(function() {
                var $this = $(this);
                if($this.data('selected')) {
                    shareids.push($this.attr('shareid'));
                }
            });
            return JSON.stringify(shareids);
        },

        /**
         * 创建专辑下拉框
         */
        'createAlbumList' : function() {
            // album ul html
            this.albumList.html(K.map(this.albumData, function(album, index) {
                var subTitle = K.subByte(album.title, 33, '...'),
                    subTitleTxt = K.subByte(album.title, 26, '...'),
                	editUserInfo = album.content.editUserInfo,
                	shareEditHTML = '',
                	privacyHTML = '';

                if(album.setting && album.setting.setting_edit == 1 && editUserInfo && editUserInfo[0]) {
                	shareEditHTML = '<i title="'+editUserInfo[0].viewname+'与我共同经营该格架" class="spr_icons i_frdcomp"></i>';
                }
                if(album.setting && album.setting.setting_view == 1) {
                	privacyHTML = '<i title="私密" class="spr_icons i_lock2"></i>';
                }
                return '<li class="_j_option" data-value="'+album.aid+'" data-text="'+subTitleTxt+'"><a href="#" class="_j_mdpvd"><i class="spr_icons i_list_album"></i><span class="dib vam">'+subTitle+'</span>'+shareEditHTML+privacyHTML+'</a></li>';
            }).join(''));

            // 设置valuebox
            var firstAlbum = this.albumData[0] || {'title' : '创建新格架'};
            this.albumValueBox.text(K.subByte(firstAlbum.title, 26, '...')).data('value', firstAlbum.aid);

            // 美化Select
            if(!this.albumSelect) {
                this.albumSelect = new Select({
                    'container' : this.albumWrap,
                    'valueBox' : this.albumValueBox,
                    'dropTrigger' : this.albumDropTrigger,
                    'dropListCnt' : this.albumListCnt,
                    'dropListInnerCnt' : this.albumList,
                    'selectedClass' : 'on',
                    'hoverItem' : $.noop
                });

                this.albumSelect.on('hide', $.proxy(function() {
                    this.albumWrap.find('._j_albumerr').css('display', 'none');
                }, this));

                // 绑定新建专辑事件
                this.albumInput.keydown($.proxy(function(ev) {
                    if(ev.keyCode === 13) { this.newAlbum(ev); }
                }, this));

                this.albumListCnt.find('._j_newalbumsubmit').click($.proxy(this.newAlbum, this));
            } else {
                this.albumSelect.value = firstAlbum.aid;
            }
        },

        /**
         * 新建专辑
         */
        'newAlbum' : function(ev) {
            var albumName = $.trim(this.albumInput.val());

            if(albumName !== '') {
                $.post('/album/new', {'title':albumName}, $.proxy(function(data) {
                    data = $.parseJSON(data);
                    if(!data.error) {
                        var subName = K.subByte(data.title, 33, '...'),
                            subNameTxt = K.subByte(data.title, 26, '...'),
                            newItem = $('<li class="_j_option" title="'+data.title+'" data-value="'+data.aid+'" data-text="'+subNameTxt+'"><a class="_j_mdpvd" href="#"><i class="spr_icons i_list_album"></i><span class="dib vam">'+subName+'</span></a></li>').appendTo(this.albumList);

                        this.albumInput.val('');
                        this.albumDropTrigger.focus();
                        this.albumSelect.selectItem(newItem);

                        // 更新专辑列表
                        if(!this.albumData) {
                            this.albumData = [];
                        }
                        this.albumData.push({'aid' : data.aid, 'title' : data.title});
                    } else {
                        this.handleAlbumErr(data.error.errno);
                    }
                }, this));
            } else {
                this.handleAlbumErr(1);
            }
            ev.preventDefault();
        },

        /**
         * 设置当前面板中的pin图
         */
        'setPic' : function() {
            var picInfo = this.pinPicInfo,
                targetImg = picInfo.targetImg,
                picWrap = this.pinDialog.find('._j_picwrap'),
                picHTML = '<img class="_j_pinboardimg _j_pinimg" width="173" title="'+targetImg.title+'" alt="'+targetImg.alt+'" src="'+targetImg.src+'">';

            this.singlePicWrap.html(picHTML).show();
            this.multiplePicWrap.hide();

            // 多图提示用户
            if(picInfo.imageInfos.length) {
                this.editTip.show();
            } else {
                this.editTip.hide();
            }

            // 图片price， 源地址
            //this.detailForm.css('display', 'none');
            this.detailSettingTrigger.removeClass('i_arrowup').addClass('i_arrowdown');
            this.detailForm.children('input[name="title"]').val(this.pinPicInfo.title || '');
            this.detailForm.children('input[name="price"]').val(this.pinPicInfo.price || '');
            this.detailForm.children('input[name="sourceurl"]').val(this.pinPicInfo.url);
            

            // 推广重置
            this.selectionUsed = false;
            this.popularized = false;

            // 默认 img desc
            if(targetImg.selectedTxt) {
            	this.pinDesc.val(targetImg.selectedTxt);
                this.pinDesc.trigger('input');
                //this.clearArea.removeClass('dn');
                this.selectionUsed = true;
            } else if(picInfo.desc) {
                this.pinDesc.val(picInfo.desc);
                this.pinDesc.trigger('input');
                //this.clearArea.removeClass('dn');
            } else {
                this.pinDesc.val('');
                this.clearArea.addClass('dn');
                this.pinDesc.trigger('input');
            }

            // 设置用户账号
            $('#_j_uaccount').text(this.userInfo.viewname);

            this.setPostTip();
        },

        'setPostTip' : function() {

            // 检测和设置用户是否使用过selection功能
        	if(this.selectionUsed) {
	        	$.post('/plugin/setting/selection/update', {'value':1});
	        } else {
	        	$.get('/plugin/setting/selection', $.proxy(function(data) {
	        		if(data == 1) {
	        		    this.selectionUsed = true;
	        		} else {
	        			$.get('/plugin/setting/selection_display', $.proxy(function(data) {
	        				if(data == 1) {
	        					this.selectionUsed = true;
	        				}
	        			}, this));
	        		}
	        	}, this))
	        }

	        // 检测和设置推广位
	        $.get('/plugin/setting/popularize', $.proxy(function(data) {
	            if(data == 1) {
	                this.popularized = true;
	            }
	        }, this));
        },

        'getAlt' : function(alt) {
            var host = this.getDomain(this.pinPicInfo.url),
                altSites = {
                    'www.duitang.com' : 1,
                    'www.163.com' : 1
                };

            if(altSites[host]) {
                return alt;
            }
        },

        'setMutiplePic' : function() {
            if(this.pinPicInfo.imageInfos.length) {
                var multiHTML = this.getMultiPicHTML(),
                    slideWrap = this.multiplePicWrap.find('._j_slidewrap');

                slideWrap.html(multiHTML);

                this.singlePicWrap.hide();
                this.multiplePicWrap.show();

                if(!this.picSlide) {
                    this.picSlide = new Slide({
                        'slideCnt' : slideWrap,
                        'slideList' : slideWrap.children('p'),
                        'prev' : this.multiplePicWrap.find('._j_prev'),
                        'next' : this.multiplePicWrap.find('._j_next'),
                        'itemSize' : 172
                    });
                } else {
                    this.picSlide.slideList = slideWrap.children('p');
                    this.picSlide.reset();
                }
            }
        },

        'getMultiPicHTML' : function() {
            var html = '';
            return K.map(this.pinPicInfo.imageInfos, function(img) {
                return '<p class="l rel"><span><img class="_j_pinboardimg _j_pinimg" width="172" title="'+img.title+'" alt="'+img.alt+'" src="'+img.src+'"></span></p>';
            }).join('');
        },

        'logPin' : function() {
            var key = this.pinPicInfo.fromPage ? 'pic_plug_buttonpin' : 'pic_plug_markpin',
                params = {
                    'uid' : Cookie.get('_kxcapiuid'),
                    'url' : this.pinPicInfo.url
                };

            this.log2(key, params);
        },

        'log1' : function(key) {
            var logImg = new Image();
            logImg.src = 'http://<?= LOG_HOST ?>/i/log1.gif?key='+key+'&t='+(+new Date);
        },

        'log2' : function(key, paraObj) {
            var params = [];
            for(var i in paraObj) {
                if(paraObj.hasOwnProperty(i)) {
                    params.push(i+'='+encodeURIComponent(paraObj[i]));
                }
            }
            var logImg = new Image();
            logImg.src = 'http://<?= LOG_HOST ?>/i/log2.gif?key='+key+'&'+params.join('&')+'&t='+(+new Date);
        }
    };

});
</script>
</html>